home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / gnt / gntbindable.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-04  |  2.6 KB  |  91 lines

  1. #ifndef GNT_BINDABLE_H
  2. #define GNT_BINDABLE_H
  3.  
  4. #include <stdio.h>
  5. #include <glib.h>
  6. #include <glib-object.h>
  7. #include <ncurses.h>
  8.  
  9. #define GNT_TYPE_BINDABLE                (gnt_bindable_get_gtype())
  10. #define GNT_BINDABLE(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BINDABLE, GntBindable))
  11. #define GNT_BINDABLE_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_BINDABLE, GntBindableClass))
  12. #define GNT_IS_BINDABLE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_BINDABLE))
  13. #define GNT_IS_BINDABLE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_BINDABLE))
  14. #define GNT_BINDABLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_BINDABLE, GntBindableClass))
  15.  
  16. #define    GNTDEBUG
  17.  
  18. typedef struct _GntBindable            GntBindable;
  19. typedef struct _GntBindableClass        GntBindableClass;
  20.  
  21. struct _GntBindable
  22. {
  23.     GObject inherit;
  24. };
  25.  
  26. struct _GntBindableClass
  27. {
  28.     GObjectClass parent;
  29.  
  30.     GHashTable *remaps;   /* Key remaps */
  31.     GHashTable *actions;  /* name -> Action */
  32.     GHashTable *bindings; /* key -> ActionParam */
  33.  
  34.     void (*gnt_reserved1)(void);
  35.     void (*gnt_reserved2)(void);
  36.     void (*gnt_reserved3)(void);
  37.     void (*gnt_reserved4)(void);
  38. };
  39.  
  40. G_BEGIN_DECLS
  41.  
  42. GType gnt_bindable_get_gtype(void);
  43.  
  44. /******************/
  45. /*   Key Remaps   */
  46. /******************/
  47. const char * gnt_bindable_remap_keys(GntBindable *bindable, const char *text);
  48.  
  49. /******************/
  50. /* Bindable Actions */
  51. /******************/
  52. typedef gboolean (*GntBindableActionCallback) (GntBindable *bindable, GList *params);
  53. typedef gboolean (*GntBindableActionCallbackNoParam)(GntBindable *bindable);
  54.  
  55. typedef struct _GntBindableAction GntBindableAction;
  56. typedef struct _GntBindableActionParam GntBindableActionParam;
  57.  
  58. struct _GntBindableAction
  59. {
  60.     char *name;        /* The name of the action */
  61.     union {
  62.         gboolean (*action)(GntBindable *bindable, GList *params);
  63.         gboolean (*action_noparam)(GntBindable *bindable);
  64.     } u;
  65. };
  66.  
  67. struct _GntBindableActionParam
  68. {
  69.     GntBindableAction *action;
  70.     GList *list;
  71. };
  72.  
  73.  
  74. /*GntBindableAction *gnt_bindable_action_parse(const char *name);*/
  75.  
  76. void gnt_bindable_action_free(GntBindableAction *action);
  77. void gnt_bindable_action_param_free(GntBindableActionParam *param);
  78.  
  79. void gnt_bindable_class_register_action(GntBindableClass *klass, const char *name,
  80.             GntBindableActionCallback callback, const char *trigger, ...);
  81. void gnt_bindable_register_binding(GntBindableClass *klass, const char *name,
  82.             const char *trigger, ...);
  83.  
  84. gboolean gnt_bindable_perform_action_key(GntBindable *bindable, const char *keys);
  85. gboolean gnt_bindable_perform_action_named(GntBindable *bindable, const char *name, ...);
  86.  
  87. G_END_DECLS
  88.  
  89. #endif /* GNT_BINDABLE_H */
  90.  
  91.